<template>
	<div class="head">
	<!-- <h1>这是用vue创建出来的文件{{msg}}</h1>
	<RouterLink to="add">登录</RouterLink>
	<RouterLink to="rest">注册</RouterLink>
	<RouterView></RouterView> -->
	<mt-header fixed title="标题过长会隐藏后面的内容啊哈哈哈哈">
	  <div @click = 'hist()' slot="left" v-show = 'falg'>
	    <mt-button icon="back">返回</mt-button>
	  </div>
	  <!-- <mt-button icon="more" slot="right"></mt-button> -->
	</mt-header>
	<transition>
		<RouterView @zdy = 'tou'></RouterView>
	</transition>
	<nav class="mui-bar mui-bar-tab">
			<RouterLink to='/home' tag = 'span'class="mui-tab-item-list">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</RouterLink>
			<RouterLink to='/member' tag = 'span'  class="mui-tab-item-list">
				<span class="mui-icon mui-icon-email"></span>
				<span class="mui-tab-label">消息</span>
			</RouterLink>
			<RouterLink to='/shopcar' tag = 'span' class="mui-tab-item-list">
				<span class="mui-icon mui-icon-extra mui-icon-extra-cart"><span class="mui-badge" v-show="falg_lt" id="point">{{ indexId }}</span></span>
				<span class="mui-tab-label">购物车</span>
			</RouterLink>
			<RouterLink to='/search' tag = 'span'  class="mui-tab-item-list">
				<span class="mui-icon mui-icon-gear"></span>
				<span class="mui-tab-label">设置</span>
			</RouterLink>
		</nav>
	</div>
</template>

<script>
	export default {
		data(){
			return {
				falg:false,
				indexId:1,
				falg_lt:true
			}
		},
		methods: {
			hist() {
				this.$router.go(-1);
			},
			tou(data){
				this.indexId = data
			}
		},
		watch:{
			"$route.path": function(newVal){
				if (newVal == '/home') {
					this.falg = false
				} else{
					this.falg = true
				}
			},
			indexId(val){
				if (val == 0) {
					this.falg_lt = false;
				}else{
					this.falg_lt = true;
				}
			}
		}
	}
</script>

<style scoped>
	.head{
		padding-top: 2.3em;
		overflow-x: hidden;
	}
	.v-enter{
		opacity: 0;
		transform: translate(100%);
	}
	.v-leave-to{
		opacity: 0;
		transform: translate(-100%);
		position: absolute;
	}
	.mint-header{
		z-index: 99;
	}
	.v-enter-active,.v-leave-active{
		transition: all 1s ease;
	}
	.mui-bar-tab .mui-tab-item-list.mui-active {
    color: #007aff;
	}
	.mui-bar-tab .mui-tab-item-list {
    display: table-cell;
    overflow: hidden;
    width: 1%;
    height: 50px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #929292;
}
.mui-bar-tab .mui-tab-item-list .mui-icon {
    top: 3px;
    width: 24px;
    height: 24px;
    padding-top: 0;
    padding-bottom: 0;
	}
	.mui-bar-tab .mui-tab-item-list .mui-icon~.mui-tab-label {
    font-size: 11px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}
</style>
